// ExecStub.h: interface for the CExecStub class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_EXECSTUB_H__10715866_494E_419A_AF3C_C768425DAF30__INCLUDED_)
#define AFX_EXECSTUB_H__10715866_494E_419A_AF3C_C768425DAF30__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <windows.h>
#include "logolib/iexec.h"

typedef struct tagDblRGB {
    double r;
    double g;
    double b;
} DblRGB;

typedef struct tagDblPoint {
    double x;
    double y;
} DblPoint;

class CExecStub : public i_exec_t 
{
public:
	CExecStub();
	virtual ~CExecStub();

    void SetExecWnd (HWND hwnd);

public:
    virtual void canvassize (double x, double y);
    virtual void reset (void);
    virtual void clear (void);
    virtual void hide (void);
    virtual void canvascolor (double r, double g, double b);
    virtual void pencolor (double r, double g, double b);
    virtual void penwidth (double w);
    virtual void go (double x, double y);
    virtual void direction (double d);
    virtual void turnright (double d);
    virtual void turnleft (double d);
    virtual void forward (double d);
    virtual void backward (double d);
    virtual void fontsize (double n);
    virtual void print (char* str);
    virtual void penup (void);
    virtual void pendown (void);
    virtual void center (void);
    virtual void gox (double d);
    virtual void goy (double d);
    virtual void wrapon (void);
    virtual void wrapoff (void);
    virtual void show (void);
    /* the returned string shall NOT be freed by the caller. */
    virtual char* inputwindow (char* str);
    virtual void message (char* str);
    virtual void debug_info (char* str);
    virtual void error_info (char* str);
    virtual void done(void);
    virtual void debug_cmd_ack(int lineno);

protected:
    HWND    m_hExecWnd;
};

/* For all MSG_EX_* messages, lParam = thread id */
/* MSG_EX_CS, 
    wParam: pointer to DblPoint
 */
#define MSG_EX_CS               (WM_USER + 1)
#define MSG_EX_RESET            (WM_USER + 2)
#define MSG_EX_CLEAR            (WM_USER + 3)
#define MSG_EX_HIDE             (WM_USER + 4)
/* MSG_EX_CC, 
    wParam: pointer to DblRGB
 */
#define MSG_EX_CC               (WM_USER + 5)
/* MSG_EX_PC, 
    wParam: pointer to DblRGB
 */
#define MSG_EX_PC               (WM_USER + 6)
/* MSG_EX_PW, 
    wParam: pointer to a double
 */
#define MSG_EX_PW               (WM_USER + 7)
/* MSG_EX_GO, 
    wParam: pointer to DblPoint
 */
#define MSG_EX_GO               (WM_USER + 8)
/* MSG_EX_DIR, 
    wParam: pointer to a double
 */
#define MSG_EX_DIR              (WM_USER + 9)
/* MSG_EX_TR, 
    wParam: pointer to a double
 */
#define MSG_EX_TR               (WM_USER + 10)
/* MSG_EX_TL, 
    wParam: pointer to a double
 */
#define MSG_EX_TL               (WM_USER + 11)
/* MSG_EX_FW, 
    wParam: pointer to a double
 */
#define MSG_EX_FW               (WM_USER + 12)
/* MSG_EX_BW, 
    wParam: pointer to a double
 */
#define MSG_EX_BW               (WM_USER + 13)
/* MSG_EX_FONTSIZE, 
    wParam: pointer to a double
 */
#define MSG_EX_FONTSIZE         (WM_USER + 14)
/* MSG_EX_PRINT, 
    wParam: pointer to a string
 */
#define MSG_EX_PRINT            (WM_USER + 15)
#define MSG_EX_PU               (WM_USER + 16)
#define MSG_EX_PD               (WM_USER + 17)
#define MSG_EX_CENTER           (WM_USER + 18)
/* MSG_EX_GOX, 
    wParam: pointer to a double
 */
#define MSG_EX_GOX              (WM_USER + 19)
/* MSG_EX_GOY, 
    wParam: pointer to a double
 */
#define MSG_EX_GOY              (WM_USER + 20)
#define MSG_EX_WRAPON           (WM_USER + 21)
#define MSG_EX_WRAPOFF          (WM_USER + 22)
#define MSG_EX_SHOW             (WM_USER + 23)
/* MSG_EX_INPUT, 
    wParam: pointer to a string
 */
#define MSG_EX_INPUT            (WM_USER + 24)
/* MSG_EX_MSG, 
    wParam: pointer to a string
 */
#define MSG_EX_MSG              (WM_USER + 25)
/* MSG_EX_DBGINFO, 
    wParam: pointer to a string
 */
#define MSG_EX_DBGINFO          (WM_USER + 26)
/* MSG_EX_ERRINFO, 
    wParam: pointer to a string
 */
#define MSG_EX_ERRINFO          (WM_USER + 27)

#define MSG_EX_DONE             (WM_USER + 28)
/* MSG_EX_ACK, 
    wParam: 0, only when wParam == MSG_EX_INPUT, it points to the returned string.
 */
#define MSG_EX_ACK              (WM_USER + 50)

/*  MSG_DEBUG_ACK,
    wParam: the lineno to which the edit shall move cursor to 
 */
#define MSG_DEBUG_ACK           (WM_USER + 120)

#endif // !defined(AFX_EXECSTUB_H__10715866_494E_419A_AF3C_C768425DAF30__INCLUDED_)
